package domain

import (
	"strconv"
	"time"
)

type Forum struct {
	Title     string    `gorm:"column:forumTitle" structs:"title" json:"title"`
	Detail    string    `gorm:"column:forumDetail" structs:"detail" json:"detail"`
	PicPath   string    `gorm:"column:forumPicPath" structs:"picpath" json:"picpath"`
	VideoPath string    `gorm:"column:forumVideoPath" structs:"videopath" json:"videopath"`
	Time      time.Time `gorm:"column:forumTime" structs:"time" json:"time"`
	ID        int       `gorm:"column:forumID" structs:"id" json:"id"`
	UnionID   string    `gorm:"column:forumUnionID" structs:"unionid" json:"unionid"`
	CommentID int       `gorm:"column:forumCommentID" structs:"commentid" json:"commentid"`
}

// 将类转化为字符串输出
func (f Forum) ToString() string {
	var resStr string
	resStr = "{ title: " + f.Title + " , picpath: " + f.PicPath + " , videopath: " + f.VideoPath + " , detail: " + f.Detail + " , time: " + f.Time.String() + " , ID: " + strconv.Itoa(f.ID) + " , openID: " + f.UnionID + " , commentID: " + string(f.CommentID) + "}"
	return resStr
}

// 指定表名
func (forum Forum) TableName() string {
	return "forum_data"
}
